import request from "@/utils/request";
import { PositionQuery, Position,PositionForm } from "./types";
import {AxiosPromise} from "axios";

export function getPositonPage(queryParams?: PositionQuery): AxiosPromise<PageResult<Position[]>>  {
  return request({
    url: '/admin/position/index',
    method: 'get',
	params: queryParams
  })
}

export function positonDisable(data: any) {
  return request({
    url: '/admin/position/disable',
    method: 'post',
    data
  })
}

export function psitonEnable(data: any) {
  return request({
    url: '/admin/position/enable',
    method: 'post',
    data
  })
}

export function createPositon(data: any) {
  return request({
    url: '/admin/position/add',
    method: 'post',
    data
  })
}

export function updatePositon(data: any) {
  return request({
    url: '/admin/position/edit',
    method: 'put',
    data
  })
}

export function delPositon(data: any) {
  return request({
    url: '/admin/position/del',
    method: 'delete',
    data
  })
}

export function getPositionForm(ids: number): AxiosPromise<PositionForm> {
  return request({
    url: "/admin/position/edit",
    method: "get",
    params: {
      ids: ids,
    },
  });
}
